package com.jackyzgy.test.RMI;

import java.io.Serializable;
import java.rmi.Naming;

public class MyRemoteClient implements Serializable {

//	public static void main(String[] args) {
//		try {
//			RemoteService remoteService = (RemoteService) Naming
//					.lookup("rmi://127.0.0.1:1099/MyRemoteService");
//			User user = remoteService.getUser("2");
//			System.out.println("username:" + user.getUsername() + ";password:"
//					+ user.getPassword());
////			System.out.println(remoteService.getString());
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//	}
	
	public static void main(String[] args) {
		try {
			RemoteService remoteService = (RemoteService) Naming
					.lookup("rmi://127.0.0.1:1099/MyRemoteService");
			User user = new User();
			user.setUsername("222222");
			user = remoteService.getUser1(user);
			System.out.println("username:" + user.getUsername() + ";password:"
					+ user.getPassword());
//			System.out.println(remoteService.getString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
